package com.neutech.solar.util;

import com.neutech.solar.constant.Constant;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public class ImageUtil {

    public static Map<String,Image> maps = new HashMap<>();
    static {
        maps.put("bg",ImageUtil.getImage("bg.jpg"));
        maps.put("sun",ImageUtil.getImage("sun.png"));
        maps.put("Mercury",ImageUtil.getImage("Mercury.png"));
        maps.put("Venus",ImageUtil.getImage("Venus.png"));
        maps.put("Earth",ImageUtil.getImage("Earth.png"));
        maps.put("Mars",ImageUtil.getImage("Mars.png"));
        maps.put("smallPlanet",ImageUtil.getImage("Mars.png"));
        maps.put("Jupiter",ImageUtil.getImage("Jupiter.png"));
        maps.put("Saturn.",ImageUtil.getImage("Saturn.png"));
        maps.put("Uranus",ImageUtil.getImage("Uranus.png"));
        maps.put("qiqihead",ImageUtil.getImage("qiqihead.png"));
    }
    private ImageUtil(){}
        public static Image getImage( String imageName){
            URL U = ImageUtil.class.getClassLoader().getResource(Constant.IMAGE_PATH_PRE+imageName);
            BufferedImage img = null;
            try{
                img = ImageIO.read(U);
            }catch (Exception e){
                e.printStackTrace();
            }
            return img;
        }
    }

